package com.hy.service.impl;

import com.hy.bean.RespBean;
import com.hy.dao.PrintManagementDao;
import com.hy.dao.impl.PrintManagementDaoImpl;
import com.hy.service.PrintManagementService;

import java.util.HashMap;

/**
 * 打印管理 service层 实现类
 */
public class PrintManagementServiceImpl implements PrintManagementService {

    private PrintManagementDao printManagementDao = new PrintManagementDaoImpl();

    @Override
    public RespBean getSalesMessage(Integer currentPage,Integer pageSize) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("salesMessageList",printManagementDao.selectSalesMessage(currentPage, pageSize));
        map.put("total",printManagementDao.countSalesMessage());
        return RespBean.success("ok",map);
    }

    @Override
    public RespBean getInventory(Integer currentPage, Integer pageSize) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("total",printManagementDao.countInventory());
        map.put("inventoryList",printManagementDao.selectInventory(currentPage, pageSize));
        return RespBean.success("ok",map);
    }

    @Override
    public RespBean getPurchase(Integer currentPage, Integer pageSize) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("total",printManagementDao.countPurchase());
        map.put("purchaseList",printManagementDao.selectPurchase(currentPage, pageSize));
        return RespBean.success("ok",map);
    }
}
